@import "~@fortawesome/fontawesome-free/scss/_variables";

// ======================================================================== all types
.collection-creator {
    height: 100%;
    overflow: hidden;

    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;

    // ------------------------------------------------------------------------ general
    ol,
    li {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    > *:not(.popover) {
        padding: 0px 8px 0px 8px;
    }
    .btn {
        border-color: #bfbfbf;
    }

    .vertically-spaced {
        margin-top: 8px;
    }
    .scroll-container {
        overflow: auto;
        //overflow-y: scroll;
    }
    .truncate {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .empty-message {
        color: grey;
        font-style: italic;
    }

    // ------------------------------------------------------------------------ flex
    &.flex-row-container,
    .flex-row-container,
    .flex-column-container {
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;

        -webkit-align-items: stretch;
        -ms-align-items: stretch;
        align-items: stretch;

        -webkit-align-content: stretch;
        -ms-align-content: stretch;
        align-content: stretch;
    }

    // a series of vertical elements that will expand to fill available space
    // Tried to drop the important here but we have divs with classes of the form:
    //    flex-column-container scroll-container flex-row
    // and flex-row specifies a row direction with important. I was unable to separate
    // this into two separate divs and get the styling right but that'd probably be a
    // better way to go longer term.
    &.flex-row-container,
    .flex-row-container {
        -webkit-flex-direction: column !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
    }
    .flex-row {
        -webkit-flex: 1 auto;
        -ms-flex: 1 auto;
        flex: 1 0 auto;
    }
    .flex-row.no-flex {
        -webkit-flex: 0 auto;
        -ms-flex: 0 auto;
        flex: 0 0 auto;
    }

    // a series of horizontal elements that will expand to fill available space
    .flex-column-container {
        -webkit-flex-direction: row;
        -ms-flex-direction: row;
        flex-direction: row;
    }
    .flex-column {
        -webkit-flex: 1 auto;
        -ms-flex: 1 auto;
        flex: 1 1 auto;
    }
    .flex-column.no-flex {
        -webkit-flex: 0 auto;
        -ms-flex: 0 auto;
        flex: 0 0 auto;
    }

    // ------------------------------------------------------------------------ sub-components
    .choose-filters {
        .help {
            margin-bottom: 2px;
            font-size: 90%;
            color: grey;
        }
        button {
            width: 100%;
            margin-top: 2px;
        }
    }

    .header .alert {
        display: none;

        li {
            list-style: circle;
            margin-left: 32px;
        }
    }

    // ------------------------------------------------------------------------ columns
    .column {
        width: 30%;
    }
    .column-title {
        height: 22px;
        line-height: 22px;
        overflow: hidden;
        &:hover {
            text-decoration: underline;
            cursor: pointer;
        }
        .title {
            font-weight: bold;
        }
        .title-info {
            color: grey;
            &:before {
                content: " - ";
            }
        }
    }

    .paired-column {
        text-align: center;
        // mess with these two to make center more/scss priority
        width: 22%;
    }

    // ------------------------------------------------------------------------ header
    .header {
        .main-help {
            margin-bottom: 17px;
            overflow: hidden;
            padding: 15px;
            &:not(.expanded) {
                // chosen to match alert - dependent on line height and .alert padding
                max-height: 49px;
                .help-content {
                    p:first-child {
                        overflow: hidden;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                    }
                    > *:not(:first-child) {
                        display: none;
                    }
                }
            }
            &.expanded {
                max-height: none;
            }

            .help-content {
                i {
                    cursor: help;
                    border-bottom: 1px dotted grey;
                    font-style: normal;
                    //font-weight: bold;
                    //text-decoration: underline;
                    //text-decoration-style: dashed;
                }
                ul,
                li {
                    list-style: circle;
                    margin-left: 16px;
                }
                .scss-help {
                    display: inline-block;
                    width: 100%;
                    text-align: right;
                }
            }
            .more-help {
                //display: inline-block;
                float: right;
            }
        }
        .column-headers {
            .column-header {
                //min-height: 45px;
                .unpaired-filter {
                    width: 100%;
                    .search-query {
                        width: 100%;
                        height: 22px;
                    }
                }
            }
        }
        .paired-column a:not(:last-child) {
            margin-right: 8px;
        }
        .reverse-column .column-title {
            text-align: right;
        }
    }

    // ------------------------------------------------------------------------ middle
    // ---- all
    // macro
    .flex-bordered-vertically {
        // huh! - giving these any static height will pull them in
        height: 0;
        // NOT setting the above will give a full-height page

        border: 1px solid lightgrey;
        border-width: 1px 0 1px 0;
    }

    .column-datasets {
        list-style: none;
        overflow: hidden;

        .dataset {
            height: 32px;
            margin-top: 2px;
            &:last-of-type {
                margin-bottom: 2px;
            }
            border: 1px solid lightgrey;
            border-radius: 3px;
            padding: 0 8px 0 8px;
            line-height: 28px;
            cursor: pointer;

            &.unpaired {
                border-color: grey;
            }

            &.paired {
                margin-left: 34px;
                margin-right: 34px;
                border: 2px solid grey;
                background: #aff1af;

                span {
                    display: inline-block;
                    overflow: hidden;
                }
                .forward-dataset-name {
                    text-align: right;
                    border-right: 1px solid grey;
                    padding-right: 8px;
                    &:after {
                        @extend .fas;
                        margin-left: 8px;
                        content: fa-content($fa-var-arrow-right);
                    }
                }
                .pair-name-column {
                    text-align: center;
                    .pair-name:hover {
                        text-decoration: underline;
                    }
                }
                .reverse-dataset-name {
                    border-left: 1px solid grey;
                    padding-left: 8px;
                    &:before {
                        @extend .fas;
                        margin-right: 8px;
                        content: fa-content($fa-var-arrow-left);
                    }
                }
            }

            &:hover {
                border-color: black;
            }

            &.selected {
                border-color: black;
                background: black;
                color: white;
                a {
                    color: white;
                }
            }
        }
    }

    // ---- unpaired
    .unpaired-columns {
        @extend .flex-bordered-vertically;

        .forward-column {
            .dataset.unpaired {
                margin-right: 32px;
            }
        }
        .paired-column {
            .dataset.unpaired {
                border-color: lightgrey;
                color: lightgrey;
                &:hover {
                    border-color: black;
                    color: black;
                }
            }
        }
        .reverse-column {
            .dataset.unpaired {
                text-align: right;
                margin-left: 32px;
            }
        }
    }

    // ---- paritition/divider
    .flexible-partition {
        .flexible-partition-drag {
            width: 100%;
            height: 8px;
            cursor: ns-resize;
            &:before {
                content: "...";
            }
            line-height: 2px;
            text-align: center;
            color: lightgrey;
            &:hover {
                background: lightgrey;
                color: black;
            }
        }
        .column-header {
            width: 100%;
            text-align: center;
            .column-title {
                display: inline;
            }
            & > *:not(:last-child) {
                margin-right: 8px;
            }
            .remove-extensions-link {
                display: none;
            }
        }
    }

    // ---- paired datasets
    .paired-columns {
        @extend .flex-bordered-vertically;
        margin-bottom: 8px;

        .column-datasets {
            width: 100%;
            overflow: auto;
        }
        .unpair-btn {
            float: right;
            margin-top: -32px;
            width: 31px;
            height: 32px;
            //z-index: 1;
            border-color: transparent;
            //border-color: #BFBFBF;
            background: transparent;
            font-size: 120%;
            &:hover {
                border-color: #bfbfbf;
                background: #dedede;
            }
        }
        .empty-message {
            text-align: center;
        }
    }
    .element-drop-placeholder {
        width: 60px;
        height: 3px;
        margin: 2px 0px 0px 14px;
        background: black;
        &:before {
            @extend .fas;
            float: left;
            font-size: 120%;
            margin: -9px 0px 0px -8px;
            content: fa-content($fa-var-caret-right);
        }
        &:last-child {
            margin-bottom: 8px;
        }
    }

    // ------------------------------------------------------------------------ footer
    .footer {
        .attributes {
            .setting-prompt {
                //margin-right: 32px;
                line-height: 32px;
                padding-left: 10px;
                .remove-extensions {
                    display: inline-block;
                    width: 24px;
                    height: 24px;
                }
                .hide-originals {
                    display: inline-block;
                    width: 24px;
                    height: 24px;
                }
            }
            // actually appears/floats to the left of the input
            .collection-name-prompt {
                margin: 5px 4px 0 0;
            }
            .collection-name-prompt.validation-warning:before {
                //TODO: localize (somehow)
                content: "(required)";
                margin-right: 4px;
                color: red;
            }
            .collection-name {
                width: 50%;
                &.validation-warning {
                    border-color: red;
                }
            }
        }
        .actions {
            .other-options > * {
                // do not display the links to create other collections yet
                display: none;
                margin-left: 4px;
            }
        }
        padding-bottom: 8px;
    }
}

// ======================================================================== list
.collection-creator.list-collection-creator {
    .footer {
        margin-top: 8px;
    }

    .main-help {
        cursor: pointer;
    }

    .collection-elements-controls {
        margin-bottom: 8px;

        .clear-selected {
            @extend .float-right;
            display: none;
        }
    }
    .collection-elements {
        max-height: 400px;
        border: 0px solid lightgrey;
        overflow-y: auto;
        overflow-x: hidden;
    }

    // TODO: taken from .dataset above - swap these out
    .collection-element {
        height: 32px;
        margin: 2px 4px 0px 4px;
        opacity: 1;
        border: 1px solid lightgrey;
        border-radius: 3px;
        padding: 0 8px 0 8px;
        line-height: 28px;
        cursor: pointer;
        overflow: hidden;

        &:last-of-type {
            margin-bottom: 2px;
        }
        &:hover {
            border-color: black;
        }
        &.selected {
            border-color: black;
            background: black;
            color: white;
            a {
                color: white;
            }
        }
        &.dragging {
            opacity: 0.4;
            button {
                display: none;
            }
        }

        .name {
            &:hover {
                text-decoration: underline;
            }
        }
        button {
            margin-top: 3px;
        }
        .discard {
            @extend .float-right;
        }
    }
    .element-drop-placeholder {
        margin-left: 8px;
        &:before {
            margin: -8.5px 0px 0px -8px;
        }
    }
    .empty-message {
        margin: 8px;
        color: grey;
        font-style: italic;
        text-align: center;
    }
    .no-elements-left-message {
        text-align: left;
    }
}

// ======================================================================== pair
.collection-creator.pair-collection-creator {
    .footer {
        margin-top: 8px;
    }

    .main-help {
        cursor: pointer;
    }

    .collection-elements-controls {
        margin-bottom: 8px;

        .clear-selected {
            @extend .float-right;
            display: none;
        }
    }
    .collection-elements {
        max-height: 400px;
        border: 0px solid lightgrey;
        overflow-y: auto;
        overflow-x: hidden;
    }

    // TODO: taken from .dataset above - swap these out
    .collection-element {
        height: 32px;
        margin: 2px 4px 0px 4px;
        opacity: 1;
        border: 1px solid lightgrey;
        border-radius: 3px;
        padding: 0 8px 0 8px;
        line-height: 28px;
        cursor: pointer;
        overflow: hidden;

        &:last-of-type {
            margin-bottom: 2px;
        }
        &:hover {
            border-color: black;
        }

        button {
            margin-top: 3px;
        }
        .identifier {
            &:after {
                content: ":";
                margin-right: 6px;
            }
        }
        .name {
            &:hover {
                text-decoration: none;
            }
        }
    }
    .empty-message {
        margin: 8px;
        color: grey;
        font-style: italic;
        text-align: center;
    }
}

// ======================================================================== list of pairs
.collection-creator.list-of-pairs-collection-creator {
    .column-headers {
        margin-bottom: 8px;
    }
}
